package com.bozhong.config.parser;

import cn.hutool.core.lang.Dict;
import org.yaml.snakeyaml.Yaml;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author fupan
 */
public class NacosDataYamlParser extends AbstractNacosDataParser {
	public NacosDataYamlParser() {
		super(",yml,yaml,");
	}

	@Override
	protected Map<String, Object> doParse(String data) {
		Map<String, Object> result = new LinkedHashMap<>();
		super.flattenedMap(result, new Yaml().loadAs(data, Dict.class), "");
		return result;
	}
}
